﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Drawing
{
    public class CRectangle : Shapes
    {

        public CRectangle(Point _StartupPosition, Point _LastPosition) : base(_StartupPosition, _LastPosition)
        {
            m_TypeColor = TypeColor.BORDER;
            m_Type = TypeShape.RECTANGLE;
            m_Width = Math.Abs(m_LastPosition.X - m_StartupPosition.X);
            m_Height = Math.Abs(m_LastPosition.Y - m_StartupPosition.Y);

           // Set m_StartupPosition
            m_StartupPosition.Y = m_LastPosition.Y < m_StartupPosition.Y ? m_LastPosition.Y : m_StartupPosition.Y;
            m_StartupPosition.X = m_LastPosition.X < m_StartupPosition.X ? m_LastPosition.X : m_StartupPosition.X;
        }

        public CRectangle(Point _StartupPosition, int _Width, int _Height) : base(_StartupPosition)
        {
            m_TypeColor = TypeColor.BORDER;
            m_Type = TypeShape.RECTANGLE;
            m_Width = _Width;
            m_Height = _Height;
            m_LastPosition.X = m_Width + m_StartupPosition.X;
            m_LastPosition.Y = m_Height + m_StartupPosition.Y;
        }

        // Get Rectangle Of C# Default
        public override Rectangle GetRectangle()
        {
            return new Rectangle(m_StartupPosition, new Size(m_Width, m_Height));
        }

        public override float GetSupperficies()
        {
            return m_Width * m_Height;
        }
    }
}
